3.2.12 \(\int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx\) [112]

Optimal. Leaf size=88 \[ \frac {(c+d x)^2}{a f}-\frac {4 d (c+d x) \log \left (1+e^{e+f x}\right )}{a f^2}-\frac {4 d^2 \text {PolyLog}\left (2,-e^{e+f x}\right )}{a f^3}+\frac {(c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f} \]

[Out]

(d*x+c)^2/a/f-4*d*(d*x+c)*ln(1+exp(f*x+e))/a/f^2-4*d^2*polylog(2,-exp(f*x+e))/a/f^3+(d*x+c)^2*tanh(1/2*f*x+1/2
*e)/a/f

________________________________________________________________________________________

Rubi [A]
time = 0.14, antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {3399, 4269, 3799, 2221, 2317, 2438} \begin {gather*} -\frac {4 d (c+d x) \log \left (e^{e+f x}+1\right )}{a f^2}+\frac {(c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {(c+d x)^2}{a f}-\frac {4 d^2 \text {Li}_2\left (-e^{e+f x}\right )}{a f^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*x)^2/(a + a*Cosh[e + f*x]),x]

[Out]

(c + d*x)^2/(a*f) - (4*d*(c + d*x)*Log[1 + E^(e + f*x)])/(a*f^2) - (4*d^2*PolyLog[2, -E^(e + f*x)])/(a*f^3) +
((c + d*x)^2*Tanh[e/2 + (f*x)/2])/(a*f)

Rule 2221

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x]
 - Dist[d*(m/(b*f*g*n*Log[F])), Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 3399

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(2*a)^n, Int[(c
 + d*x)^m*Sin[(1/2)*(e + Pi*(a/(2*b))) + f*(x/2)]^(2*n), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && EqQ[a^2
- b^2, 0] && IntegerQ[n] && (GtQ[n, 0] || IGtQ[m, 0])

Rule 3799

Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (Complex[0, fz_])*(f_.)*(x_)], x_Symbol] :> Simp[(-I)*((c + d*x)^(m
 + 1)/(d*(m + 1))), x] + Dist[2*I, Int[(c + d*x)^m*(E^(2*((-I)*e + f*fz*x))/(1 + E^(2*((-I)*e + f*fz*x)))), x]
, x] /; FreeQ[{c, d, e, f, fz}, x] && IGtQ[m, 0]

Rule 4269

Int[csc[(e_.) + (f_.)*(x_)]^2*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(-(c + d*x)^m)*(Cot[e + f*x]/f), x
] + Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cot[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rubi steps

\begin {align*} \int \frac {(c+d x)^2}{a+a \cosh (e+f x)} \, dx &=\frac {\int (c+d x)^2 \csc ^2\left (\frac {1}{2} (i e+\pi )+\frac {i f x}{2}\right ) \, dx}{2 a}\\ &=\frac {(c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}-\frac {(2 d) \int (c+d x) \tanh \left (\frac {e}{2}+\frac {f x}{2}\right ) \, dx}{a f}\\ &=\frac {(c+d x)^2}{a f}+\frac {(c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}-\frac {(4 d) \int \frac {e^{2 \left (\frac {e}{2}+\frac {f x}{2}\right )} (c+d x)}{1+e^{2 \left (\frac {e}{2}+\frac {f x}{2}\right )}} \, dx}{a f}\\ &=\frac {(c+d x)^2}{a f}-\frac {4 d (c+d x) \log \left (1+e^{e+f x}\right )}{a f^2}+\frac {(c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {\left (4 d^2\right ) \int \log \left (1+e^{2 \left (\frac {e}{2}+\frac {f x}{2}\right )}\right ) \, dx}{a f^2}\\ &=\frac {(c+d x)^2}{a f}-\frac {4 d (c+d x) \log \left (1+e^{e+f x}\right )}{a f^2}+\frac {(c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}+\frac {\left (4 d^2\right ) \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 \left (\frac {e}{2}+\frac {f x}{2}\right )}\right )}{a f^3}\\ &=\frac {(c+d x)^2}{a f}-\frac {4 d (c+d x) \log \left (1+e^{e+f x}\right )}{a f^2}-\frac {4 d^2 \text {Li}_2\left (-e^{e+f x}\right )}{a f^3}+\frac {(c+d x)^2 \tanh \left (\frac {e}{2}+\frac {f x}{2}\right )}{a f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains complex when optimal does not.
time = 4.44, size = 295, normalized size = 3.35 \begin {gather*} \frac {2 \cosh \left (\frac {1}{2} (e+f x)\right ) \text {sech}\left (\frac {e}{2}\right ) \left (2 c d f \cosh \left (\frac {1}{2} (e+f x)\right ) \left (-2 \cosh \left (\frac {e}{2}\right ) \log \left (\cosh \left (\frac {1}{2} (e+f x)\right )\right )+f x \sinh \left (\frac {e}{2}\right )\right )+d^2 \cosh \left (\frac {1}{2} (e+f x)\right ) \left (2 \cosh \left (\frac {e}{2}\right ) \left (-i \left (f \pi x-2 \pi \log \left (1+e^{f x}\right )-2 i f x \log \left (1-e^{-f x-2 \tanh ^{-1}\left (\coth \left (\frac {e}{2}\right )\right )}\right )+2 \pi \log \left (\cosh \left (\frac {f x}{2}\right )\right )\right )-2 \tanh ^{-1}\left (\coth \left (\frac {e}{2}\right )\right ) \left (f x+2 \log \left (1-e^{-f x-2 \tanh ^{-1}\left (\coth \left (\frac {e}{2}\right )\right )}\right )-2 \log \left (i \sinh \left (\frac {f x}{2}+\tanh ^{-1}\left (\coth \left (\frac {e}{2}\right )\right )\right )\right )\right )+2 \text {PolyLog}\left (2,e^{-f x-2 \tanh ^{-1}\left (\coth \left (\frac {e}{2}\right )\right )}\right )\right )+e^{-\tanh ^{-1}\left (\coth \left (\frac {e}{2}\right )\right )} f^2 x^2 \sqrt {-\text {csch}^2\left (\frac {e}{2}\right )} \sinh \left (\frac {e}{2}\right )\right )+f^2 (c+d x)^2 \sinh \left (\frac {f x}{2}\right )\right )}{a f^3 (1+\cosh (e+f x))} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

Integrate[(c + d*x)^2/(a + a*Cosh[e + f*x]),x]

[Out]

(2*Cosh[(e + f*x)/2]*Sech[e/2]*(2*c*d*f*Cosh[(e + f*x)/2]*(-2*Cosh[e/2]*Log[Cosh[(e + f*x)/2]] + f*x*Sinh[e/2]
) + d^2*Cosh[(e + f*x)/2]*(2*Cosh[e/2]*((-I)*(f*Pi*x - 2*Pi*Log[1 + E^(f*x)] - (2*I)*f*x*Log[1 - E^(-(f*x) - 2
*ArcTanh[Coth[e/2]])] + 2*Pi*Log[Cosh[(f*x)/2]]) - 2*ArcTanh[Coth[e/2]]*(f*x + 2*Log[1 - E^(-(f*x) - 2*ArcTanh
[Coth[e/2]])] - 2*Log[I*Sinh[(f*x)/2 + ArcTanh[Coth[e/2]]]]) + 2*PolyLog[2, E^(-(f*x) - 2*ArcTanh[Coth[e/2]])]
) + (f^2*x^2*Sqrt[-Csch[e/2]^2]*Sinh[e/2])/E^ArcTanh[Coth[e/2]]) + f^2*(c + d*x)^2*Sinh[(f*x)/2]))/(a*f^3*(1 +
 Cosh[e + f*x]))

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(173\) vs. \(2(82)=164\).
time = 1.51, size = 174, normalized size = 1.98

method result size
risch \(-\frac {2 \left (d^{2} x^{2}+2 c d x +c^{2}\right )}{f a \left ({\mathrm e}^{f x +e}+1\right )}-\frac {4 d c \ln \left ({\mathrm e}^{f x +e}+1\right )}{a \,f^{2}}+\frac {4 d c \ln \left ({\mathrm e}^{f x +e}\right )}{a \,f^{2}}+\frac {2 d^{2} x^{2}}{a f}+\frac {4 d^{2} e x}{a \,f^{2}}+\frac {2 d^{2} e^{2}}{a \,f^{3}}-\frac {4 d^{2} \ln \left ({\mathrm e}^{f x +e}+1\right ) x}{a \,f^{2}}-\frac {4 d^{2} \polylog \left (2, -{\mathrm e}^{f x +e}\right )}{a \,f^{3}}-\frac {4 d^{2} e \ln \left ({\mathrm e}^{f x +e}\right )}{a \,f^{3}}\) \(174\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)^2/(a+a*cosh(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

-2/f*(d^2*x^2+2*c*d*x+c^2)/a/(exp(f*x+e)+1)-4/a/f^2*d*c*ln(exp(f*x+e)+1)+4/a/f^2*d*c*ln(exp(f*x+e))+2/a/f*d^2*
x^2+4/a/f^2*d^2*e*x+2/a/f^3*d^2*e^2-4/a/f^2*d^2*ln(exp(f*x+e)+1)*x-4*d^2*polylog(2,-exp(f*x+e))/a/f^3-4/a/f^3*
d^2*e*ln(exp(f*x+e))

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+a*cosh(f*x+e)),x, algorithm="maxima")

[Out]

-2*d^2*(x^2/(a*f*e^(f*x + e) + a*f) - 2*integrate(x/(a*f*e^(f*x + e) + a*f), x)) + 4*c*d*(x*e^(f*x + e)/(a*f*e
^(f*x + e) + a*f) - log((e^(f*x + e) + 1)*e^(-e))/(a*f^2)) + 2*c^2/((a*e^(-f*x - e) + a)*f)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 359 vs. \(2 (84) = 168\).
time = 0.50, size = 359, normalized size = 4.08 \begin {gather*} -\frac {2 \, {\left (c^{2} f^{2} - 2 \, c d f \cosh \left (1\right ) + d^{2} \cosh \left (1\right )^{2} + d^{2} \sinh \left (1\right )^{2} - {\left (d^{2} f^{2} x^{2} + 2 \, c d f^{2} x + 2 \, c d f \cosh \left (1\right ) - d^{2} \cosh \left (1\right )^{2} - d^{2} \sinh \left (1\right )^{2} + 2 \, {\left (c d f - d^{2} \cosh \left (1\right )\right )} \sinh \left (1\right )\right )} \cosh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) + 2 \, {\left (d^{2} \cosh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) + d^{2} \sinh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) + d^{2}\right )} {\rm Li}_2\left (-\cosh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) - \sinh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right )\right ) + 2 \, {\left (d^{2} f x + c d f + {\left (d^{2} f x + c d f\right )} \cosh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) + {\left (d^{2} f x + c d f\right )} \sinh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right )\right )} \log \left (\cosh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) + \sinh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) + 1\right ) - 2 \, {\left (c d f - d^{2} \cosh \left (1\right )\right )} \sinh \left (1\right ) - {\left (d^{2} f^{2} x^{2} + 2 \, c d f^{2} x + 2 \, c d f \cosh \left (1\right ) - d^{2} \cosh \left (1\right )^{2} - d^{2} \sinh \left (1\right )^{2} + 2 \, {\left (c d f - d^{2} \cosh \left (1\right )\right )} \sinh \left (1\right )\right )} \sinh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right )\right )}}{a f^{3} \cosh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) + a f^{3} \sinh \left (f x + \cosh \left (1\right ) + \sinh \left (1\right )\right ) + a f^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+a*cosh(f*x+e)),x, algorithm="fricas")

[Out]

-2*(c^2*f^2 - 2*c*d*f*cosh(1) + d^2*cosh(1)^2 + d^2*sinh(1)^2 - (d^2*f^2*x^2 + 2*c*d*f^2*x + 2*c*d*f*cosh(1) -
 d^2*cosh(1)^2 - d^2*sinh(1)^2 + 2*(c*d*f - d^2*cosh(1))*sinh(1))*cosh(f*x + cosh(1) + sinh(1)) + 2*(d^2*cosh(
f*x + cosh(1) + sinh(1)) + d^2*sinh(f*x + cosh(1) + sinh(1)) + d^2)*dilog(-cosh(f*x + cosh(1) + sinh(1)) - sin
h(f*x + cosh(1) + sinh(1))) + 2*(d^2*f*x + c*d*f + (d^2*f*x + c*d*f)*cosh(f*x + cosh(1) + sinh(1)) + (d^2*f*x
+ c*d*f)*sinh(f*x + cosh(1) + sinh(1)))*log(cosh(f*x + cosh(1) + sinh(1)) + sinh(f*x + cosh(1) + sinh(1)) + 1)
 - 2*(c*d*f - d^2*cosh(1))*sinh(1) - (d^2*f^2*x^2 + 2*c*d*f^2*x + 2*c*d*f*cosh(1) - d^2*cosh(1)^2 - d^2*sinh(1
)^2 + 2*(c*d*f - d^2*cosh(1))*sinh(1))*sinh(f*x + cosh(1) + sinh(1)))/(a*f^3*cosh(f*x + cosh(1) + sinh(1)) + a
*f^3*sinh(f*x + cosh(1) + sinh(1)) + a*f^3)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {c^{2}}{\cosh {\left (e + f x \right )} + 1}\, dx + \int \frac {d^{2} x^{2}}{\cosh {\left (e + f x \right )} + 1}\, dx + \int \frac {2 c d x}{\cosh {\left (e + f x \right )} + 1}\, dx}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)**2/(a+a*cosh(f*x+e)),x)

[Out]

(Integral(c**2/(cosh(e + f*x) + 1), x) + Integral(d**2*x**2/(cosh(e + f*x) + 1), x) + Integral(2*c*d*x/(cosh(e
 + f*x) + 1), x))/a

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+a*cosh(f*x+e)),x, algorithm="giac")

[Out]

integrate((d*x + c)^2/(a*cosh(f*x + e) + a), x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\left (c+d\,x\right )}^2}{a+a\,\mathrm {cosh}\left (e+f\,x\right )} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*x)^2/(a + a*cosh(e + f*x)),x)

[Out]

int((c + d*x)^2/(a + a*cosh(e + f*x)), x)

________________________________________________________________________________________